<script>
import { defineComponent, getCurrentInstance } from "vue";

export default defineComponent({
  props: {
    that: Object,
  },
  setup(props) {
    return { that: props.that };
  },
  render() {
    let that = this.that;
    return (
      <a-collapse bordered={false}>
        <a-collapse-panel header="设置链接">
          <div class="styleValue">
            <span>链接类型</span>
            <a-radio-group
              value={this.$store.state.aimAttrs.goto.type}
              onChange={(e) => {
                this.gotoJud = e == "none" ? false : true;
                this.$store.commit("aimAttrsChange", {
                  newValue: { type: e, value: null },
                  attrsName: "goto",
                  that,
                });
              }}
            >
              <a-radio-button value="none">无</a-radio-button>
              <a-radio-button value="in">站内</a-radio-button>
              <a-radio-button value="out">站外</a-radio-button>
            </a-radio-group>
          </div>
          {this.gotoJud && (
            <div class="styleValue">
              <span>链接</span>
              <a-input
                value={this.$store.state.aimAttrs.goto.value}
                placeholder="请输入链接"
                onInput={(e) => {
                  this.$store.commit("aimAttrsChange", {
                    newValue: {
                      type: this.$store.state.aimAttrs.goto.type,
                      value: e,
                    },
                    attrsName: "goto",
                    that,
                  });
                }}
              ></a-input>
            </div>
          )}
        </a-collapse-panel>
      </a-collapse>
    );
  },
});
</script>
